#ifndef DATABASEMANAGER_H
#define DATABASEMANAGER_H

#include <QObject>

#include <QSqlDatabase>
#include <QSqlRelationalTableModel> // 多表操作
#include <QSqlQuery>

class DatabaseManager : public QObject
{
    Q_OBJECT
public:
    explicit DatabaseManager(QObject *parent = nullptr);

    // 连接数据库
    bool connectMysql();
    // 判断是否登录成功
    bool login(QString username, QString password);
signals:

public slots:

private:
    QSqlRelationalTableModel* serialModel;
    QSqlRelationalTableModel* portModel;

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    QSqlQuery query;
};

#endif // DATABASEMANAGER_H
